A data transmission method, comprising: Sending, by a terminal device, a random access request message to a network device by using a first random access resource, wherein the first random access resource is used to indicate that the terminal device requests to transmit first data in an initial access process, and the random access request message comprises a random access preamble; Receiving, by the terminal device, a random access response, RAR message that is sent by the network device and that comprises a first information, wherein the first information is used to indicate a transmission resource allocated by the network device to the terminal device, and the transmission resource is used to transmit a radio resource control, RRC, message; characterized by Sending, by the terminal device based on a result of comparing a size of the transmission resource with a size of the RRC message and a result of comparing the/a size of the transmission resource with a size of second data, the first data to the network device by using a specified message, wherein the second data comprises the RRC message and the first data; wherein the sending, by the terminal device based on at least one of a result of comparing a size of the transmission resource with a size of the RRC message and a result of comparing the/a size of the transmission resource with a size of second data, the first data to the network device by using a specified message comprises: if the size of the transmission resource is greater than or equal to the size of the second data, sending, by the terminal device, the first data to the network device by using the RRC message; if the size of the transmission resource is greater than the size of the RRC message and the size of the transmission resource is less than the size of the second data, sending, by the terminal device, the RRC message to the network device and sending the first data to the network device by using an uplink message following the RRC message. Sending, by a terminal device, a random access request message to a network device by using a first random access resource, wherein the first random access resource is used to indicate that the terminal device requests to transmit first data in an initial access process, and the random access request message comprises a random access preamble; Receiving, by the terminal device, a random access response, RAR message that is sent by the network device and that comprises a first information, wherein the first information is used to indicate a transmission resource allocated by the network device to the terminal device, and the transmission resource is used to transmit a radio resource control, RRC, message; characterized by Sending, by the terminal device based on a result of comparing a size of the transmission resource with a size of the RRC message and a result of comparing the/a size of the transmission resource with a size of second data, the first data to the network device by using a specified message, wherein the second data comprises the RRC message and the first data; wherein the sending, by the terminal device based on at least one of a result of comparing a size of the transmission resource with a size of the RRC message and a result of comparing the/a size of the transmission resource with a size of second data, the first data to the network device by using a specified message comprises: if the size of the transmission resource is greater than or equal to the size of the second data, sending, by the terminal device, the first data to the network device by using the RRC message; if the size of the transmission resource is greater than the size of the RRC message and the size of the transmission resource is less than the size of the second data, sending, by the terminal device, the RRC message to the network device and sending the first data to the network device by using an uplink message following the RRC message. if the size of the transmission resource is greater than or equal to the size of the second data, sending, by the terminal device, the first data to the network device by using the RRC message; if the size of the transmission resource is greater than the size of the RRC message and the size of the transmission resource is less than the size of the second data, sending, by the terminal device, the RRC message to the network device and sending the first data to the network device by using an uplink message following the RRC message.